C code for getting and setting selection formulas

The following code demonstrates the use of the PEGetSelectionFormula and PESetSelectionFormula functions:

PEGetSelectionFormula

HANDLE        textHandle;
short        textLength;
char        *formulaString;
if (!PEGetSelectionFormula(Job, &textHandle, &textLength)){
    // Handle error
}
    // Allocate formulaString buffer
formulaString = (char*)malloc(textLength);
    // Retrieve actual formula string
if (!PEGetHandleString(textHandle, formulaString, textLength)){
    // Handle error
}
    // formulaString now contains text of selection formula

PESetSelectionFormula

char selectionFormula [] = "{orders.AMOUNT} > 1000.00";
if (!PESetSelectionFormula(Job, selectionFormula)){
    // Handle error
}


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com